package com.wbcs.system.datatype;

import javassist.ClassPool;
import javassist.CtClass;
import javassist.NotFoundException;

import org.dom4j.Element;

import com.wbcs.exception.WbcsConfigLoadingException;

public abstract class AbsDataType implements IDataType
{

    public void loadTypeConfig(Element eleDataType)
    {

    }

    public IDataType setUserConfigString(String configstring)
    {
        return this;
    }

    public String value2label(Object value)
    {
        if(value==null) return "";
        return String.valueOf(value);
    }

    public CtClass getCreatedClass(ClassPool pool)
    {
        try
        {
            return pool.get(getJavaTypeClass().getName());
        }catch(NotFoundException e)
        {
            throw new WbcsConfigLoadingException("没有找到"+getJavaTypeClass().getName()
                    +"类型，无法创建此类型的成员变量",e);
        }
    }
}
